﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.OMM.HealthMonitor.Entity.Common;

namespace Sinacor.OMM.HealthMonitor.Entity.Msmq
{
    [Serializable()]
    public class MsmqData : IHealthDataReset
    {

        HealthEntityBase _healthEntityBase;

        public MsmqData()
        {
            _healthEntityBase = new HealthEntityBase();
        }

        public MsmqData(HealthEntityBase healthEntityBase)
        {
            _healthEntityBase = healthEntityBase;
        }

        //Limite
        private bool _limitQueueAcessible;//Fila Acessível
        private long _limitQueuedMessages;//Mensagens Represadas na Fila
        private long _limitQueueBytesSize;//Tamanho da fila (Bytes)

        //Informacao
        private string _queuePath; //Nome da Fila
        private bool _queueAcessible;//Fila Acessível
        private long _messagesPerSecond;//Mensagem por segundo
        private long _queuedMessages;//Mensagens Represadas na Fila
        private long _queueBytesSize;//Tamanho da fila (Bytes)


        public bool LimitQueueAcessible
        {
            get { return _limitQueueAcessible; }
            set 
            {
                _limitQueueAcessible = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public long LimitQueuedMessages
        {
            get { return _limitQueuedMessages; }
            set 
            { 
                _limitQueuedMessages = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public long LimitQueueBytesSize
        {
            get { return _limitQueueBytesSize; }
            set 
            {
                _limitQueueBytesSize = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public string QueuePath
        {
            get { return _queuePath; }
            set 
            { 
                _queuePath = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public bool QueueAcessible
        {
            get { return _queueAcessible; }
            set 
            { 
                _queueAcessible = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }
                
        public long MessagesPerSecond
        {
            get { return _messagesPerSecond; }
            set 
            { 
                _messagesPerSecond = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public long QueuedMessages
        {
            get { return _queuedMessages; }
            set 
            { 
                _queuedMessages = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public long QueueBytesSize
        {
            get { return _queueBytesSize; }
            set 
            { 
                _queueBytesSize = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        ErrorData _errorData;

        ErrorData ErrorData
        {
            get { return _errorData; }
            set
            {
                _errorData = value;
                _healthEntityBase.LastUpdate = DateTime.Now;
            }
        }

        public void Reset()
        {
            QueuePath = String.Empty;
            QueueAcessible = false;
            QueueBytesSize = 0;
            QueuedMessages = 0;
            MessagesPerSecond = 0;
            LimitQueueAcessible = false;
            LimitQueueBytesSize = 0;
            LimitQueuedMessages = 0;
            ErrorData.Reset();
        }
    }
}
